Thibaut FABACHER
GMRC
ggplot(data = <DATA>, mapping = aes(<MAPPINGS>)) + <GEOM_FUNCTION>()
Aesthetic mappings` décrit comment les variables de data sont mapper sur des formes géométriques
Code un graphiques vides car des données des aesthetic mappings mais pas d’aesthetic
Les scales permettent de modifier les axes x et y Par défaut R en ajoute pour chaque aesthetic
!!! Attention, tronques les données
palettes pré spécifiées
packages : scico, paletteer, wesanderson,
Spécifier des dégradés : scale_color_gradient(), scale_color_gradient2(), scale_color_gradientn()
palette manuelle : scale_fill_manual(values = c(“#000000”, “#E69F00”, “#56B4E9”, “#009E73”,“#F0E442”, “#0072B2”, “#D55E00”, “#CC79A7”))
https://www.datanovia.com/en/fr/blog/couleurs-ggplot-meilleures-astuces-que-vous-allez-adorer/
scale_fill_discrete()
scale_color_discrete()
scale_color_manual()
…
Spécifie les éléments non en rapport avec les données
labelled <- base +
labs(
x = "City mileage/gallon",
y = "Highway mileage/gallon",
colour = "Cylinders",
title = "Highway and city mileage are highly correlated"
) +
scale_colour_brewer(type = "seq", palette = "Spectral")
labelled_stylise <- labelled+ theme_bw() +
theme(
plot.title = element_text(face = "bold", size = 12),
legend.background = element_rect(fill = "white", size = 4, colour = "white"),
legend.justification = c(0, 1),
legend.position = c(0, 1),
axis.ticks = element_line(colour = "grey70", size = 0.2),
panel.grid.major = element_line(colour = "grey70", size = 0.2),
panel.grid.minor = element_blank()
)theme_bw(): a variation on theme_grey() that uses a white background and thin grey grid lines.
theme_linedraw(): A theme with only black lines of various widths on white backgrounds, reminiscent of a line drawing.
- theme_light(): similar to theme_linedraw() but with light grey lines and axes, to direct more attention towards the data. |
|---|
- theme_minimal(): A minimalistic theme with no background annotations. |
- theme_classic(): A classic-looking theme, with x and y axis lines and no gridlines. |
theme_void(): A completely empty theme.ggThemeAssist
Master Intelligence des données de santé / UE Technique